<template>
  <div>
    <transition name="fade" mode="out-in">
      <keep-alive :include="pages">
        <component :is="currentView"></component>
      </keep-alive>
    </transition>
  </div>
</template>

<script>
  import List from './list'
  import Detail from './detail'

  export default {
    name: 'portCont',
    data() {
      return {
        index: 0,
        views: ['List', 'Detail'],
        pages: ['port-cont-list']
        // pages: ['port-cont-list', 'port-cont-detail']
      }
    },
    computed: {
      currentView() {
        return this.views[this.index]
      }
    },
    methods: {
      changeView(index) {
        this.index = index
      },
      back() {
        this.changeView(0)
      }
    },
    components: {
      List,
      Detail
    }
  }
</script>


<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" rel="stylesheet/scss" type="text/scss">

</style>
